package com.example.authority.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Data;

import lombok.experimental.Accessors;


/**
 * @program: authority-hm-0.0.1
 * @ClassName:Goods
 * @description: 商品列表 实体类
 * @author:dyy
 * @Version 3.0
 **/

@Data
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_goods")
@Schema(title = "Goods对象", description = "商品列表")
public class Goods implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(title = "序列号")
    @TableId(value = "id", type = IdType.AUTO)
    @ExcelProperty("序列号")
    private Long id;

    @Schema(title = "商品名称")
    @TableField("name")
    @ExcelProperty("商品名称")
    private String name;

    @Schema(title = "商品图片")
    @TableField("img")
    @ExcelProperty("商品图片")
    private String img;

    @Schema(title = "商品单价")
    @TableField("price")
    @ExcelProperty("商品单价")
    private Double price;

    @Schema(title = "商品库存")
    @TableField("store")
    @ExcelProperty("商品库存")
    private Integer store;

    @Schema(title = "商品销量")
    @TableField("sales")
    @ExcelProperty("商品销量")
    private Integer sales;

    @Schema(title = "是否上架")
    @TableField("is_show")
    @ExcelProperty("是否上架")
    private Integer isShow;

    @Schema(title = "是否推荐")
    @TableField("is_recommand")
    @ExcelProperty("是否推荐")
    private Integer isRecommand;

    @Schema(title = "所属类型")
    @TableField("cid")
    @ExcelProperty("所属类型")
    private Long cid;
    @Schema(title = "所属类型")
    @TableField(exist = false)
    @ExcelIgnore
    private Category category = new Category();

    @Schema(title = "商品详情")
    @TableField("content")
    @ExcelProperty("商品详情")
    private String content;

    @Schema(title = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @Schema(title = "修改时间")

    @ExcelProperty("修改时间")
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @Schema(title = "创建账户")
    @TableField("username")
    @ExcelProperty("创建账户")
    private String username;


}
